#include <iostream>
#include <cstdio>


void Solution1(){
    int a;
    std::cin >> a;
    std::cout << std::oct << a;
}

void Solution2(){
    int a;
    scanf("%d", &a);
    printf("%x", a);
}

void Solution3(){
    int result[1000]{};
    
    int a;
    std::cin >> a;

    int i = 0;
    while(a != 0){
        result[i++] = a % 8;
        a /= 8;
    }

    for (int j = i - 1; j >= 0; j--) {
        printf("%d", result[j]);
    }

}

/**
 * 八进制转十进制
 */
int main(){

    Solution3();
    return 0;
}